import instance from '../request/index'
//登录
export const loginApi=(username,password)=>{
    return instance({
        url:'http://localhost:12345/api/user/login',
        method:'POST',
        data:{
            username,password
        }
    })
}
//分类
export const classifyApi=()=>{
    return instance({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/categories',
        method:'GET',
    })
}
//详情
export const detailApi=(goods_id)=>{
    return instance({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',
        method:'GET',
        params:{
            goods_id
        }
    })
}
//生成订单
export const createApi=(items)=>{
    return instance({
        url:'http://localhost:12345/api/order/create',
        method:'POST',
        data:{
            ...items
        }
    })
}
//获取订单详情
export const getOrderApi=(orderid)=>{
    return instance({
        url:'http://localhost:12345/api/order/getOrder/'+orderid,
        method:'GET',
    })
}
//支付订单
export const payApi=(itemd)=>{
    return instance({
        url:'http://localhost:12345/api/order/pay',
        method:'POST',
        data:{
            ...itemd
        }
    })
}